<template>
  <div class="app-container">
  <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">  
    <el-form-item label="检测点名称" prop="pointsName">
      <el-input
        v-model="queryParams.pointsName"
        placeholder="请输入检测点名称"
        clearable
        @keyup.enter.native="handleQuery"
      />
    </el-form-item>
    <el-form-item label="检测点地址" prop="pointsAddress">
      <el-input
        v-model="queryParams.pointsAddress"
        placeholder="请输入检测点地址"
        clearable
        @keyup.enter.native="handleQuery"
      />
    </el-form-item>
    <el-form-item label="状态" prop="status">
      <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
        <el-option
          v-for="dict in dict.type.dc_prewarning"
          :key="dict.value"
          :label="dict.label"
          :value="dict.value"
        />
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
      <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
    </el-form-item>
  </el-form>

  <el-row :gutter="10" class="mb8">
    <el-col :span="1.5">
      <el-button
        type="primary"
        plain
        icon="el-icon-plus"
        size="mini"
        @click="handleAdd"
        v-hasPermi="['dc:prewarning:add']"
      >新增</el-button>
    </el-col>
    <el-col :span="1.5">
      <el-button
        type="success"
        plain
        icon="el-icon-edit"
        size="mini"
        :disabled="single"
        @click="handleUpdate"
        v-hasPermi="['dc:prewarning:edit']"
      >修改</el-button>
    </el-col>
    <el-col :span="1.5">
      <el-button
        type="danger"
        plain
        icon="el-icon-delete"
        size="mini"
        :disabled="multiple"
        @click="handleDelete"
        v-hasPermi="['dc:prewarning:remove']"
      >删除</el-button>
    </el-col>
    <el-col :span="1.5">
      <el-button
        type="warning"
        plain
        icon="el-icon-download"
        size="mini"
        @click="handleExport"
        v-hasPermi="['dc:prewarning:export']"
      >导出</el-button>
    </el-col>
    <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  </el-row>

  <el-table v-loading="loading" :data="prewarningList" @selection-change="handleSelectionChange">
    <el-table-column type="selection" width="55" align="center" />
    <el-table-column label="编号" align="center" prop="id" />
    <el-table-column label="检测点名称" align="center" prop="pointsName" />
    <el-table-column label="检测点地址" align="center" prop="pointsAddress" />
    <el-table-column label="实时功率" align="center" prop="realTimePower" />
    <el-table-column label="实时电压" align="center" prop="realTimeVolt" />
    <el-table-column label="状态" align="center" prop="status">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.dc_prewarning" :value="scope.row.status"/>
      </template>
    </el-table-column>
    <el-table-column label="上报时间" align="center" prop="reportTime" width="180">
      <template slot-scope="scope">
        <span>{{ parseTime(scope.row.reportTime, '{y}-{m}-{d}') }}</span>
      </template>
    </el-table-column>
    <el-table-column label="备注" align="center" prop="mark" />
    <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
      <template slot-scope="scope">
        <el-button
          size="mini"
          type="text"
          icon="el-icon-edit"
          @click="handleUpdate(scope.row)"
          v-hasPermi="['dc:prewarning:edit']"
        >修改</el-button>
        <el-button
          size="mini"
          type="text"
          icon="el-icon-delete"
          @click="handleDelete(scope.row)"
          v-hasPermi="['dc:prewarning:remove']"
        >删除</el-button>
      </template>
    </el-table-column>
  </el-table>
  
  <pagination
    v-show="total>0"
    :total="total"
    :page.sync="queryParams.pageNum"
    :limit.sync="queryParams.pageSize"
    @pagination="getList"
  />

  <!-- 添加或修改智造双碳-能效预警对话框 -->
  <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
    <el-form ref="form" :model="form" :rules="rules" label-width="100px">
      <el-form-item label="检测点名称" prop="pointsName">
        <el-input v-model="form.pointsName" placeholder="请输入检测点名称" />
      </el-form-item>
      <el-form-item label="检测点地址" prop="pointsAddress">
        <el-input v-model="form.pointsAddress" placeholder="请输入检测点地址" />
      </el-form-item>
      <el-form-item label="实时功率" prop="realTimePower">
        <el-input v-model="form.realTimePower" placeholder="请输入实时功率" />
      </el-form-item>
      <el-form-item label="实时电压" prop="realTimeVolt">
        <el-input v-model="form.realTimeVolt" placeholder="请输入实时电压" />
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-select v-model="form.status" placeholder="请选择状态">
          <el-option
            v-for="dict in dict.type.dc_prewarning"
            :key="dict.value"
            :label="dict.label"
            :value="parseInt(dict.value)"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="上报时间" prop="reportTime">
        <el-date-picker clearable
          v-model="form.reportTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择上报时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="备注" prop="mark">
        <el-input v-model="form.mark" placeholder="请输入备注" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </el-dialog>
</div>
</template>

<script>

export default {
name: "Prewarning",
data() {
  return {

  };
},
created() {
},
methods: {

}
};
</script>

